/************************singletondownloader.h***************************/
/*****************************************************************************/
/*******************Browsers Daily Build Updater************************/
/************Copyright (C) 2010-2011  Gianluigi Biancucci*************/
/*****************************************************************************/
/*****This is free software, and you are welcome to redistribute it****/
/*****and / or modify underthe terms of GPLV2 License.**************/
/*****This program comes with ABSOLUTELY NO WARRANTY*****/
/*****************************************************************************/

#ifndef SINGLETONDOWNLOADER_H
#define SINGLETONDOWNLOADER_H
#include<QString>
#include<QWidget>
#include <QFile>
#include <QNetworkAccessManager>
#include <QNetworkProxy>
#include <QBuffer>
#include <QEventLoop>
class SingletonDownloader :public QNetworkAccessManager
{
    Q_OBJECT

public:
    static SingletonDownloader* getInstance();

    bool syncGet(QString url, QByteArray *byteArray);
    void proxySet (QString proxyName, unsigned int port);
    void proxyRemove ();
public slots:
   void progress ( qint64 bytesReceived, qint64 bytesTotal ) ;
signals:
   void nextStep();
protected slots:

     virtual void finished(QNetworkReply * reply);

private:
    qint64 progressTemp;
    qint64 progressUnit;
    SingletonDownloader();
    static SingletonDownloader*  _instance;
    QNetworkProxy proxy;
    QEventLoop loop;

};


#endif // SINGLETONDOWNLOADER_H
